#!/bin/fish 
#UFUNCTION=联网随机显示名言
function hello
	set js (curl -s https://v1.hitokoto.cn/)
	set text (echo $js | jq '.hitokoto')
	set text (string replace -a "\"" "" "$text") #去除引号
	set author (echo $js | jq '.from') #提取
	set author (string replace -a "\"" "" "$author") #去除引号
	set text (echo "    $text ---[$author]")
	set da (date +%Y年%m月%d日)
	set user (hostname)
    set cnt (count $argv)
    if test $cnt -eq 0
	   echo -e "\033[36m[Hello, $user! Today is $da!] \033[0m"
       echo -e "\033[36m$text\033[0m"
    else
       echo -e "\033[36m$text\033[0m"
    end
	
	
end
